import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '卖方',
    align:"center",
    dataIndex: 'seller'
   },
   {
    title: '合同开始时间',
    align:"center",
    dataIndex: 'contractStartTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '合同结束时间',
    align:"center",
    dataIndex: 'contractEndTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '合同名称',
    align:"center",
    dataIndex: 'contractName'
   },
   {
    title: '合同编号',
    align:"center",
    dataIndex: 'contractId'
   },
   {
    title: '合同性质',
    align:"center",
    dataIndex: 'contractProperties_dictText'
   },
   {
    title: '合同类别',
    align:"center",
    dataIndex: 'contractType_dictText'
   },
   {
    title: '保管人',
    align:"center",
    dataIndex: 'managePerson'
   },
   {
    title: '签订时间',
    align:"center",
    dataIndex: 'signTime'
   },
   {
    title: '合同金额',
    align:"center",
    dataIndex: 'contractAmount'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "合同性质",
      field: "contractProperties",
      component: 'JDictSelectTag',
      componentProps:{
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '关联客户供应商',
    field: 'supplierName',
    component: 'Input',
  },
  {
    label: '卖方',
    field: 'seller',
    component: 'Input',
  },
  {
    label: '合同开始时间',
    field: 'contractStartTime',
    component: 'DatePicker',
  },
  {
    label: '合同结束时间',
    field: 'contractEndTime',
    component: 'DatePicker',
  },
  {
    label: '合同名称',
    field: 'contractName',
    component: 'Input',
  },
  {
    label: '合同编号',
    field: 'contractId',
    component: 'Input',
  },
  {
    label: '合同性质',
    field: 'contractProperties',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
  },
  {
    label: '合同类别',
    field: 'contractType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
  },
  {
    label: '保管人',
    field: 'managePerson',
    component: 'Input',
  },
  {
    label: '签订时间',
    field: 'signTime',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '合同金额',
    field: 'contractAmount',
    component: 'InputNumber',
  },
  {
    label: '是否含税',
    field: 'istax',
    component: 'Input',
  },
  {
    label: '税点',
    field: 'taxPoint',
    component: 'Input',
  },
  {
    label: '收款人全称',
    field: 'fullNameOfPayee',
    component: 'Input',
  },
  {
    label: '税务登记账号',
    field: 'taxRegistrationAccountNo',
    component: 'Input',
  },
  {
    label: '收款人账号',
    field: 'collectionAccountNo',
    component: 'Input',
  },
  {
    label: '收款人开户行',
    field: 'bankOfDeposit',
    component: 'Input',
  },
  {
    label: '附件',
    field: 'enclosure',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const purchaseContractDetailColumns: JVxeColumn[] = [
    {
      title: '序号',
      key: 'sccpid',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '主表ID',
      key: 'scid',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '商品编码',
      key: 'commodityId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '商品名称',
      key: 'commodityName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '商品类型',
      key: 'commodityType',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '规格型号',
      key: 'specifications',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '计量单位',
      key: 'company',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '含税单价',
      key: 'unitPrice',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '合同数量',
      key: 'contractCount',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '价税合计',
      key: 'totalAmount',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '税率',
      key: 'taxRate',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '税额',
      key: 'taxAmount',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '折扣率',
      key: 'discountRate',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '已回款金额',
      key: 'returnAmount',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '未回款金额',
      key: 'noReturnAmount',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '不含税金额',
      key: 'noTaxAmount',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '合同金额',
      key: 'contractAmount',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '供货日期',
      key: 'supplyDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '要货日期',
      key: 'purchaseDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '备注',
      key: 'remark',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
export const purchaseContractCollectionPlanColumns: JVxeColumn[] = [
    {
      title: '序号',
      key: 'sccpid',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '主表ID',
      key: 'scid',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '批次',
      key: 'batch',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '收款约定时间',
      key: 'agreedCollectionTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '收款比例',
      key: 'collectionProportion',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '收款金额',
      key: 'amountCollected',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
